#ifndef PHYSICS_H
#define PHYSICS_H

#include "Common.h"

#define MAX_SAMPLE_SIZE 2.0f
#define QUICK_COLLIDE_PENETRATION 1.0f

namespace GenBen {

enum RectCollision
{
	NO_COLLISION = 0,
	COLLIDE_TOP = 1,
	COLLIDE_BOTTOM = 2,
	COLLIDE_LEFT = 4,
	COLLIDE_RIGHT = 8,
	COLLIDE_FULL = 16
};

// Informs if rectangles collide, and if they do, on which edges of second rectangle first rectangle lies.
RectCollision collideRect(const RectF& rect1, const RectF& rect2);

// Returns true if rectangles collide.
bool quickCollideRect(const RectF& rect1, const RectF& rect2);

// Collides single rect against many others. Returns true if collision.
bool collideRects(const RectF& rect, uint n_rects, RectF* rects);

// Collides single moving rect against many static ones. Returns final rect position, before any collisions.
RectF multisampledCollision(const RectF& rect, const VectorI& shift, uint n_static_rects, RectF* static_rects);

// Same as function above, just moves in both axes separatly to achieve sliding effect.
RectF multisampledSlidingCollision(const RectF& rect, const VectorF& shift, uint n_static_rects, RectF* static_rects);

} // namespace

#endif